<?php
/**
 * 退卡记录
 *
 * @auther 大耳牛
 * 2017-2-16
 **/
namespace Xijie\Model;
use Think\Model;
class CardlogModel extends Model{
	//定义表名称
	protected $tableName = 'cardlog';
	
	/**
	 * 获取会员列表总数
	 *
	 **/
	public function getCardlogCount($where){
		return $this->alias('cardlog')->where($where)->count();
	}
	
	/**
	 * 获取会员列表
	 *
	 **/
	public function getCardlogList($page, $where){
		return $this->alias('cardlog')
					->join('left join momoda_users as users on cardlog.user_id = users.user_id')
					->field('cardlog.*, users.nickname as uname')
					->where($where)
					->order('id desc')
					->page($page, C('PAGE_SIZE'))
					->select();
	}
	
	/**
	 * 添加支付日志
	 **/
	public function addCardlogInfo($data){
		return $this->data($data)->add();
	}
}